app.controller('goodsController', function($scope, $http, utilService, $location) {

	$scope.cols = [
		{name: '序号', column: '$index', width: '60px'},
		{name: '商品名称', column: 'name'},
		{name: '价格', column: 'price', width: '100px'},
		{name: '介绍', column: 'detail'},
		{name: '类别', column: 'classify', width: '120px'}
	];

	var initList = function() {

		utilService.ajax({
			url: '../../../shopping2/api/goods_list.php',
			data: {size: 5},
			ok: function(response) {
				if (response.success) {
					$scope.gList = response.data;
				} else {
					// ...
				}
			}
		}, $scope);

		/*$scope.showLoading = true;

		$http({
			url: '../../../shopping2/api/goods_list.php',
			method: 'get',
			params: {}
		}).success(function(response) {
			if (response.success) {
				$scope.gList = response.data;
			} else {
				// ...
			}
			$scope.showLoading = false;
		});*/

	};

	$scope.$on("$viewContentLoaded", function(){
        initList();
        // urlService.setNavStatus($location.$$path);
    });

});
